package com.qianli.user.facade.impl.frozen;

import com.fqgj.common.api.Response;
import com.qianli.user.application.UserFrozenApplication;
import com.qianli.user.facade.frozen.UserFrozenServiceFacade;
import com.qianli.user.ro.UserStateCode;
import com.qianli.user.ro.frozen.UserFrozenRO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * name:冷冻
 * auth:ting.li@qianli-inc.com
 * date:2018/1/3 18:12
 * version: v1.0.0
 **/
@Service("userFrozenServiceFacade")
public class UserFrozenServiceFacadeImpl implements UserFrozenServiceFacade{

    @Autowired
    private UserFrozenApplication userFrozenApplication;
    /**
     * 冷冻用户
     * @param userFrozen
     * @return
     */
    @Override
    public Response<Boolean> frozenUser(UserFrozenRO userFrozen) {
        if(null == userFrozen){
//            LOGGER.info("UserFrozenServiceFacade.frozenUser  param can not be null");
            return Response.error(UserStateCode.PARAMETER_LACK,"参数不能为空");
        }
        if(null == userFrozen.getUserCode()){
//            LOGGER.info("UserFrozenServiceFacade.frozenUser  param userCode can not be null");
            return Response.error(UserStateCode.PARAMETER_LACK,"参数userCode不能为空");
        }
        if(null == userFrozen.getCode()){
//            LOGGER.info("UserFrozenServiceFacade.frozenUser  param code can not be null");
            return Response.error(UserStateCode.PARAMETER_LACK,"参数code不能为空");
        }
        Response<Boolean> response = userFrozenApplication.frozenUser(userFrozen);
        return response;
    }
}
